package com.javasea.patterns.strategy.base.strategy;

import com.javasea.patterns.strategy.base.Stock;
import com.javasea.patterns.strategy.base.Strategy;

import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 低价榜
 */
public class LowPriceRank implements Strategy {

    @Override
    public List<Stock> sort(List<Stock> source) {
        return source.stream()
                .sorted(Comparator.comparing(Stock::getPrice))
                .collect(Collectors.toList());
    }
}
